package com.xin.mmall.config;

import com.xin.mmall.entity.User;
import com.xin.mmall.filter.UserFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;
/*过滤器配置类*/
@Configuration
public class FilterConfig {
    @Bean
    public FilterRegistrationBean filterRegistrationBean(){
        FilterRegistrationBean filterFilterRegistrationBean = new FilterRegistrationBean();
        filterFilterRegistrationBean.setFilter(new UserFilter());
        filterFilterRegistrationBean.addUrlPatterns("/cart/*","/orders/*","/user/userInfo/*");
        return filterFilterRegistrationBean;
    }
}
